<?php
    include("header.php");
    setTabIndex(6);
    createPage("Liga - Clubs");
    if (isset($_SESSION['user'])) $user = $_SESSION['user'];
?>

<table height="100%" cellSpacing="0" cellPadding="0" width="100%" border="0" bgcolor="#FFFFFF">

    <tr>

        <td id="leftFiller" valign="top" height="100%" rowspan="3" bgcolor="#666666">

            <table border="0" cellpadding="0" cellspacing="0" height="100%" width="8px">

                <tr><td>&nbsp;</td></tr>

            </table>

        </td>

        <td id="header" valign="top" width="100%">

            <table border="0" width="100%" cellpadding="3" cellspacing="0" bgcolor="#10425b">

                <tr>

                    <td bgcolor="#666666" width="70%">

                        <span class="headerLarge">Clubs</span>

                        <br>

                        <span class="headerMedium">Bestuur, Info</span>

                    </td>

                    <td bgcolor="#666666" align="right" valign="top">&nbsp;



                    </td>

                </tr>

            </table>

            <table align="center" border="0" width="100%" height="90%" cellpadding="0" cellspacing="0" style="border-top:#BCDD10 4px solid;">

                <tr>

                    <td>&nbsp;</td>

                    <td width="100%" height="20" colspan="2" class="quicklink">

                        <a href="clubs.php" target="content">info</a> |

                        <a href="clubs.php" target="content">bestuur</a>

                    </td>

                </tr>

                <tr>

                    <td colspan="2" nowrap bgcolor="#BCDD10" height="4"><img src="../assets/images/spacer.gif" alt="" height="1" width="1"></td>

                </tr>

                <tr>

                    <td>&nbsp;</td>

                    <td valign="top">

                        <table align="left" cellspacing="10" width="100%">

                            <tr>

                                <td><span class="blackHeaderLarge">Info</span></td>

                            </tr>

                            <tr>

                                <td>Alle informatie omtrent schaakclubs in de provincie Antwerpen vindt u hier.<br/>

                                Klik op het clubnummer voor detailinfo.<br/>

                                Eigenaars van een account kunnen hun clubgegevens zelf aanpassen (login rechtsboven).

                                <br/>&nbsp;&nbsp;

                                </td>

                            </tr>

                            <?php

                                if ( isset($user) && $user->club_id == 100 ) {

                            ?>

                            <tr>

                                <td><a href="insert_club_form.php"><img border="0" src="../../assets/images/24x24/shadow/book_blue_add.gif">

                                <strong style="font-size:11px">Schrijf een nieuwe club in</strong></a>

                                </td>

                            </tr>

                            <?php

                                }

                            ?>

                            <tr>

                                <td>

                                    <table width="95%" align="center" cellspacing="0" cellpadding="2" class="yellowBox">

                                        <tr>

                                            <td style="border-bottom:#A6C218 dashed 1px">&nbsp;</td>

                                            <td style="border-bottom:#A6C218 dashed 1px">&nbsp;</td>

                                            <td width="10%" style="border-bottom:#A6C218 dashed 1px"><strong>Nummer</strong></td>

                                            <td width="30%" style="border-bottom:#A6C218 dashed 1px"><strong>Naam</strong></td>

                                            <td width="30%" style="border-bottom:#A6C218 dashed 1px"><strong>Website</strong></td>

                                            <td width="20%" style="border-bottom:#A6C218 dashed 1px"><strong>E-mail</strong></td>

                                        </tr>

                                        <?php

                                            mysql_connect(DB_SERVER, DB_USER, DB_PWD);

                                            mysql_select_db(DB_CATALOG);

                                            $result = mysql_query("select * from club where clubname <> ''");



                                            $clubItems = array();

                                            while ($row = mysql_fetch_assoc($result)) {

                                                if (!isset($clubId) || $clubId != $row['club_id']) {

                                                    $clubId = $row['club_id'];

                                                    $clubItem = new ClubItem;

                                                    $clubItem->club_id = $row['club_id'];

                                                    $clubItem->clubname = $row['clubname'];

                                                    $clubItem->correspondent = $row['correspondent'];

                                                    $clubItem->correspondent_email = $row['correspondent_email'];

                                                    $clubItem->correspondent_function = $row['correspondent_function'];

                                                    $clubItem->website = $row['website'];

                                                    $clubItem->playdate_adults = $row['playdate_adults'];

                                                    $clubItem->playdate_youth = $row['playdate_youth'];

                                                    $clubItem->site = $row['site'];

                                                    $clubItem->site_address = $row['site_address'];

                                                    $clubItem->email_club = $row['email_club'];

                                                    $clubItem->comment = $row['comment'];

                                                    array_push($clubItems, $clubItem);

                                                }

                                            }



                                            mysql_free_result($result);



                                            $link = "";

                                            foreach ($clubItems as $item) {

                                                if (empty($item->website)) {

                                                    $item->website = "&nbsp";

                                                }

                                        ?>

                                        <tr>

                                        <?php

                                                if ( isset($user) && $user->club_id == $item->club_id ) {

                                        ?>

                                            <td style="border-bottom:#DDDDDD solid 1px"><a href="edit_club_form.php?club_id=<?=$item->club_id?>"><img src="../../assets/images/16x16/shadow/document.gif" border="0"></a></td>

                                            <td style="border-bottom:#DDDDDD solid 1px">&nbsp;</td>

                                        <?php

                                                } else if ( isset($user) && $user->club_id == 100 ) {

                                        ?>

                                            <td style="border-bottom:#DDDDDD solid 1px"><a href="edit_club_form.php?club_id=<?=$item->club_id?>"><img src="../../assets/images/16x16/shadow/document.gif" border="0"></a></td>

                                            <td style="border-bottom:#DDDDDD solid 1px"><a href="delete_club.php?club_id=<?=$item->club_id?>"><img src="../../assets/images/16x16/shadow/delete2.gif" border="0"></a></td>

                                        <?php

                                                } else {

                                        ?>

                                               <td style="border-bottom:#DDDDDD solid 1px">&nbsp;</td>

                                            <td style="border-bottom:#DDDDDD solid 1px">&nbsp;</td>

                                        <?php

                                                }



                                        ?>

                                            <td style="border-bottom:#DDDDDD solid 1px" valign="top"><a href="club_detail.php?club_id=<?=$item->club_id?>"><?=$item->club_id?></a></td>

                                            <td style="border-bottom:#DDDDDD solid 1px" valign="top"><?=$item->clubname?></td>

                                        <?php

                                                if ( strstr($item->website, "http://") == true ||

                                                    strstr($item->website, "www.") == true ) {

                                        ?>

                                            <td style="border-bottom:#DDDDDD solid 1px" valign="top"><a href="<?=$item->website?>" target="_blank"><?=$item->website?></a></td>

                                        <?php

                                                } else {

                                        ?>

                                            <td style="border-bottom:#DDDDDD solid 1px" valign="top"><?=$item->website?></td>

                                        <?php

                                                }



                                                if ( strstr($item->email_club, "@") == true ) {

                                        ?>

                                            <td style="border-bottom:#DDDDDD solid 1px" valign="top"><a href="mailto:<?=$item->email_club?>"><?=$item->email_club?></td>

                                        </tr>

                                        <?php

                                                } else {

                                        ?>

                                            <td style="border-bottom:#DDDDDD solid 1px" valign="top"><?=$item->email_club?></td>

                                        <?php

                                                }

                                            }

                                        ?>

                                    </table>

                                </td>

                            </tr>

                        </table>

                    </td>

                </tr>

            </table>

        </td>

    </tr>

</table>



</body>

</html>

